package com.cifz.reducerdemo

import android.util.Log
import com.redux.core.Middleware

internal val appMiddleware: Middleware<AppState> =
    { dispatch, _ ->
        { next ->
            { action ->
                when (action) {
                    is TestOneAction -> {
                        Log.d(Constant.TAG, "收到了消息 : ${action.content}")
                        next(action.copy(content = "消息被我修改了"))
                    }
                }
            }
        }
    }

internal val appMiddleware1: Middleware<AppState> =
    { dispatch, _ ->
        { next ->
            { action ->
                when (action) {
                    is TestOneAction -> {
                        Log.d(Constant.TAG, "收到了消息11 : ${action.content}")
                        next(action.copy(content = "消息被我修改了11"))
                    }
                }
            }
        }
    }